package org.bt.forecast.service;

import org.bt.forecast.dto.DltDto;
import org.bt.forecast.dto.LotteryDto;
import org.bt.forecast.dto.NewestDto;
import org.bt.forecast.dto.SsqDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LotteryService {

    @Autowired
    private SsqService ssqService;
    @Autowired
    private DltService dltService;

    /**
     * 获取最新一期彩票号码
     */
    public NewestDto getNewest() {
        ssqService.updateSsq();
        dltService.updateDlt();
        return new NewestDto(ssqService.getNewest(), dltService.getNewest());
    }

    /**
     * 双色球选号
     */
    public SsqDto getSsq() {
        return new SsqDto(ssqService.get());
    }

    /**
     * 大乐透选号
     */
    public DltDto getDlt() {
        return new DltDto(dltService.get());
    }

    /**
     * 双色球&大乐透选号
     */
    public LotteryDto getLottery() {
        return new LotteryDto(getSsq(), getDlt());
    }

}
